<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="bim.ui.css">
		<script src="bim.viewer.js"></script>

	</head>
	<style>
		html,
		body {
		    height: 100%;
		    width: 100%;
		    margin: 0;
		    padding: 0;
		}
	</style>
	<body>
		<div id="containerDiv">
		
		</div>
		<script>
			var dom = document.getElementById('containerDiv');
			let viewer = new BIMI.BimViewer(dom,{loading:true});
			let toolbar = new BIMI.Toolbar(viewer);
			//通过url加载轻量化文件
			viewer.load('rac_basic_sample_project/bim.bin')
			//测试viewer事件 
			viewer.on(BIMI.ViewerEvent.LOADED, model => {
			    console.info(model)
			});
			viewer.on(BIMI.ViewerEvent.PICK,(event)=>{
			    this.modelId = event.data[0].modelId;
			    var product = viewer.getProduct(event.data[0].modelId,event.data[0].productId);
			    console.info(product);
			})
			viewer.on(BIMI.ViewerEvent.DBL_CLICK,(event)=>{
			    console.info(event.data);
			    viewer.zoomToProduct(event.data[0].modelId,event.data[0].productId,true);
			})
			
			viewer.on(BIMI.ViewerEvent.CONTEXT_MENU,event=>{
			    console.info(event)
			})
		</script>
	</body>
</html>
